<template>
<div>
   <NavType />
   <List />
   <Recommend />
   <Rank />
   <Like />
   <!-- 这里遍历拿到数据的floor，并把每个floor数据传给对应的floor-->
   <Floor v-for=" floor in floorList" :key="floor.id" :floor='floor'/>
   <Brand />
</div>
   
</template>

<script>
import List from './List'  
import Recommend from './Recommend'  
import Rank from './Rank'  
import Like from './Like'  
import Floor from './Floor'  
import Brand from './Brand'  


//引入请求floor的api
import {getFloorListRequest} from '@/api'

export default {
    name:'Home',
    data(){
       return{
         floorList:[]
       }
    },
    components:{
        List,
        Recommend,
        Rank,
        Like,
        Floor,
        Brand
        
    },
    mounted(){
        this.getFloorList()
    },
    //floor需要遍历生成，所以在home中请求数据
    methods: {
       async getFloorList(){
            const re = await getFloorListRequest()
            // console.log(re);
            this.floorList = re
        }
    },
}
</script>

<style lang='less' scoped>

</style>